﻿
using MyFloridaHouse.libSvOpenDistricts.Dialogs;
using MyFloridaHouse.libSvCommonUtilities;
using MyFloridaHouse.libSvOpenDistricts.Criteria;
namespace MyFloridaHouse.libSvOpenDistricts.ViewModel
{
    public partial class ViewModelBase
    {
        public PrefCustomizeCriteriaDlg prefCustomizeCriteriaDlg;

        private bool CmdPrefCriteriaCanExecute(object parameter)
        {
            return true;
        }

        private void CmdPrefCriteriaExecute(object parameter)
        {
            prefCustomizeCriteriaDlg = new PrefCustomizeCriteriaDlg(OnMemberPropertyChanged, DisplayPanelForDialogs);
            prefCustomizeCriteriaDlg.Start(prefCustomizeCriteriaDlgDone);
            prefCustomizeCriteriaDlg.Reset(CriteriaDatasetManager.GetDatasetNames(), dataGridManager.criteriaDatasetName, regionLabel.criteriaDatasetName, regionFill.criteriaDatasetName);
        }

        private void prefCustomizeCriteriaDlgDone(bool result)
        {
            if (result)
            {
                // set the new criteria values
                dataGridManager.LoadCriteriaDataset(prefCustomizeCriteriaDlg.gridCriteriaDatasetName);
                regionLabel.LoadCriteriaDataset(prefCustomizeCriteriaDlg.labelCriteriaDatasetName);
                regionFill.LoadCriteriaDataset(prefCustomizeCriteriaDlg.fillCriteriaDatasetName);
            }
            prefCustomizeCriteriaDlg = null;
        }



    }
}
